package ch.bfh.abch.rems.receiver.tinkerforge;

import ch.bfh.abch.rems.interfaces.MulticasterDataPersister;
import ch.bfh.abch.rems.receiver.MulticastReceiver;
import ch.bfh.abcm.rems.sensors.tinkerforge.TFSensorType;
import ch.bfh.abcm.rems.tinkerforge.TFClusterNodeAverage;

public class TFMulticastReceiver extends MulticastReceiver {

    public TFMulticastReceiver(MulticasterDataPersister persiser, String multicastAdress, int receiverPort) {
        super(persiser, multicastAdress, receiverPort);
    }

    @Override
    protected void receivedTFNodeAverage(TFClusterNodeAverage tfClusterNodeAverage) {
        int value = tfClusterNodeAverage.getValue();
        String clusterNodeID = tfClusterNodeAverage.getClusterNodeID();
        TFSensorType sensortype = tfClusterNodeAverage.getSensorType();
        logger.debug("TFNA {value="+value+" clusterNodeID="+clusterNodeID+" sensortype="+sensortype+"}");
        dataPersiser.receivedNodeAverage(value, clusterNodeID, sensortype);
    }
}
